<?php
session_start();
  require_once('../system/dbConn.php');  
  require_once('../system/myFunc.php');  
  $username = $_POST["username"];
  $password = $_POST["password"];
  connect();
  $sql = "select * from admins where adminname='".$username."' and password=('".$password."')"; 
  //echo $sql."<br/>";
  //$result = mysql_query($sql) or die('查询失败！'.mysql_error());
  $result =fetch_one($sql);
  //判断是否合法用户，如果是合法用户，则转向用户列表页面，否则转向登录页面
  //$num = mysql_num_rows($result);
  if($result){   
    $_SESSION['user']=$result;
    //var_dump($_SESSION);
    //3秒后转向用户列表页面
    redirect('user-list.php', '登录成功!');
    //header("location:userList.php");  
  }else{
    redirect('login.html', '用户名或密码错误！请重新登录！');    
    //header("location:login.html");    
  } 
?>
